Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement system-upgrade plugin #1209

Conversation

evan-goode
Copy link
Member

@evan-goode evan-goode commented Jan 29, 2024

For #1052.

The system-upgrade plugin is responsible for performing "offline" upgrades of the system. It has three main subcommands:

  • dnf5 system-upgrade download: Does a dry run of an upgrade to a new releasever and stores the resulting transaction for later.
  • dnf5 system-upgrade reboot: Creates a "magic symlink" at /system-update to trigger the start of dnf5-system-upgrade.service on the next boot, then reboots. See https://www.freedesktop.org/software/systemd/man/latest/systemd.offline-updates.html. dnf5-system-upgrade.service will take the place of the usual boot target so we can preform the upgrade without disturbing too many running processes.
  • dnf5 system-upgrade upgrade: Not intended to be run by the user directly, but rather by dnf5-system-upgrade.service. Loads the transaction saved by system-upgrade download and performs the upgrade. Interacts with Plymouth (if it's available) to show upgrade progress on the animated boot screen. The usual DNF 5 stdout is additionally logged to journald. Reboots or powers off when the upgrade is complete.

This implementation is, for the most part, a straightforward port of the DNF 4 system-upgrade plugin in dnf-plugins-core (formerly in dnf-plugins-extras). It uses the DNF 5 transaction load/store API.

It's still a work in progress, but most of the functionality from DNF 4 system-upgrade is ported over and it's been successfully updating F38 to F39 without hiccups. Things left to do:

  • Plymouth output
  • Doc page
  • log subcommand
  • Go back through commit history of dnf-plugins-extras to make sure no historical issues with DNF 4 system-upgrade are present in the new implementation
  • Tests: port test_system_upgrade.py

In my opinion, each of these (perhaps with the exception of the log subcommand) is a high-priority item, but they could be split off into future PRs if desired.

Implementing transaction callbacks for Plymouth and keeping the progress
bars on stdout meant extending RpmTransCB, meaning RpmTransCB had to
move to the public API.
@evan-goode evan-goode self-assigned this Jan 29, 2024
@kontura kontura self-requested a review February 1, 2024 09:24
@jan-kolarik
Copy link
Member

I've done an initial review by scanning through the code. @kontura, please feel free to proceed with your planned proper review 🙂

@Conan-Kudo
Copy link
Member

We need offline-distrosync and offline-upgrade commands too. These are regularly used to run this offline update mode for in-release packages.

This commit brings in systemd-devel as a build dependency for
dnf5-plugins so system-upgrade can log directly to journald and so the
`log` subcommand can search the journal for upgrade logs. Perhaps in a
subsequent patch, this dependency can be put behind a switch.
@evan-goode evan-goode force-pushed the evan-goode/system-upgrade branch from c104b43 to 1dd933d Compare February 2, 2024 22:59

auto transaction = goal->resolve();
if (transaction.get_problems() != libdnf5::GoalProblem::NO_PROBLEM) {
throw libdnf5::cli::GoalResolveError(transaction);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer more specific error here but we also need the resolve logs.

Can we at least add comment saying something like: This indicates some bigger problem since the transaction was already successfully resolved before.

@kontura
Copy link
Contributor

kontura commented Feb 5, 2024

We need offline-distrosync and offline-upgrade commands too. These are regularly used to run this offline update mode for in-release packages.

We would like to be able to run any command offline using some generic switch. Some more details in: #1224

@evan-goode
Copy link
Member Author

Superseded by #1280 which implements system-upgrade as a regular command, not a plugin, and adds the --offline switch and offline command.

@evan-goode evan-goode closed this Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants